﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using VPN.DataContext;

namespace VPN.Manage
{
    public class ProductManage
    {
        public static Product[] GetProductList()
        {
            using (PODataContext pdc = new PODataContext(ConfigurationManager.ReadOnlyConnectionString))
            {
                pdc.ObjectTrackingEnabled = false;
                return pdc.Products.ToArray();
            }
        }

        public static Product GetProductByID(Guid pid)
        {
            using (PODataContext pdc = new PODataContext(ConfigurationManager.ReadOnlyConnectionString))
            {
                pdc.ObjectTrackingEnabled = false;
                return pdc.Products.Where(p => p.ProductID == pid).FirstOrDefault();
            }
        }


    }
}
